<?php
/**
 * @package Woodle
 * @version 1.0
 */
/*
 Plugin Name: Woodle
 Plugin URI: http://inf.usi.ch/
 Description: Moodle for Wordpress
 Version: 1.0
 Author: Thomas, Stefano and Giulio
 License: GPL2
 */

/* Define global variables */
define('WOO_DEBUG', (bool)WP_DEBUG);
define('WOO_PLUGIN_DIR', dirname(__FILE__));

function addToHeader() {
	echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/woodle/css/style.css" />' . "\n";
	wp_enqueue_script('woodle', get_bloginfo('wpurl') . '/wp-content/plugins/woodle/js/script.js', array('jquery', 'jquery-ui-datepicker'));
	wp_enqueue_style('datepickerStyle', get_bloginfo('wpurl') . '/wp-content/plugins/woodle/css/jquery-ui-1.8.20.custom.css');
}

/* Load Components */
require_once WOO_PLUGIN_DIR . '/php/woodle_install.class.php';
require_once WOO_PLUGIN_DIR . '/php/woodle_db_manager.class.php';
require_once WOO_PLUGIN_DIR . '/php/admin/woodle_admin.php';

//Initialize objects
$woodb = new WoodleDBManager();
$install = new WoodleInstall();


register_activation_hook(__FILE__, array(&$install, 'activate'));
register_deactivation_hook(__FILE__, array(&$install, 'deactivate'));

// [woo]
function woo_func() {
	include "php/front/woodle_front.php";
}


add_action('activate_woodle/woodle.php', array(&$admin, 'init'));
add_action("wp_head", "addToHeader", 1);
add_shortcode('woo', 'woo_func');

?>
